import react, {Component} from 'react'

interface ChildrenDemo1Inter {
  name: string;
  age: number;
  sex: string;
  onClick: (text: string) => void
}

class ChildrenDemo1 extends Component<ChildrenDemo1Inter> {
  render () {
    const { name, age, sex, onClick } = this.props
    return (
      <div>
      <h1 onClick={() => {
        console.log('子组件事件')
        onClick('传递给父组件的内容')
      }}>组件通信 父传字</h1>
      <ul>
        <li>{name}</li>
        <li>{age}</li>
        <li>{sex}</li>
      </ul>
    </div>
    )
  }
}

export default ChildrenDemo1